﻿using Cngot.Extensions.EventBus.RabbitMQ;
using Cngot.Extensions.EventBus.RabbitMQ.Integration;
using System;
using System.Threading.Tasks;

namespace WebApi.Consumer
{
    [MessageSubscribe("direct-delay", null, RabbitExchangeType.X_Delayed_Message, instance: "rabbit-delay")]
    public class DelayRabbitConsumerListener : IRabbitConsumerListener
    {
        public Task HandleAsync(RecieveResult recieveResult)
        {
            Console.WriteLine($"接受时间{DateTime.Now}" + ", RabbitConsumerListener:" + recieveResult.Body);
            recieveResult.Commit();
            //result.RollBack();//回滚，参数表示是否重新消费
            return Task.CompletedTask;
        }
    }
}
